Skip to main content

Java Backend Developer Interview Questions - Complete Guide

Core Java (35 Questions)โ€‹

Fundamentals & JVM Internalsโ€‹

  1. What is Java and why is it platform-independent?
  2. Explain the main features of Java (WORA, OOP, Multithreading, Security)
  3. Differences between JDK, JVM, and JRE
  4. How does JVM work? Explain Class Loader, Runtime Data Area, Execution Engine
  5. What is JIT (Just-In-Time) compiler?
  6. What is bytecode? How does Java achieve platform independence?
  7. What is the difference between == and .equals()?
  8. Difference between Heap and Stack memory
  9. What is garbage collection? Explain different GC algorithms
  10. What are memory leaks in Java? How to prevent them?
  11. What are Wrapper classes? Explain autoboxing and unboxing
  12. Why is Java not a pure object-oriented language?
  13. What is the difference between primitive types and reference types?

OOP Principles (12 Questions)โ€‹

  1. Explain the four pillars of OOP with real-world examples:

    • Encapsulation (data hiding, access control)
    • Inheritance (code reusability, IS-A relationship)
    • Polymorphism (compile-time and runtime)
    • Abstraction (hiding implementation details)
  2. What is inheritance and its types in Java? (Single, Multilevel, Hierarchical)

  3. Why doesn't Java support multiple inheritance? How to achieve it?

  4. Difference between method overloading and overriding (with rules)

  5. Can we override static methods? Can we overload them?

  6. What is method hiding vs method overriding?

  7. What is abstraction? Difference between abstract class and interface (Java 8+)

  8. Can we create an object of an abstract class? Can abstract class have constructor?

  9. What are default and static methods in interfaces (Java 8+)?

  10. What are functional interfaces? Name built-in functional interfaces

  11. What are marker interfaces? Give examples (Serializable, Cloneable, Remote)

  12. Difference between composition and inheritance (HAS-A vs IS-A)

Keywords, Access Modifiers & Best Practicesโ€‹

  1. Explain access modifiers: public, private, protected, default (with package visibility)
  2. What is the static keyword and its uses? (variable, method, block, nested class)
  3. Can we override static methods? What is static binding vs dynamic binding?
  4. What is the final keyword? Effects on class, method, and variable
  5. Difference between final, finally, and finalize()
  6. What are transient and volatile keywords?
  7. What is strictfp keyword?
  8. Difference between this and super keyword

Constructors & Object Creationโ€‹

  1. What are constructors and their types? (default, parameterized, copy)
  2. What is constructor chaining? Difference between this() and super()
  3. Can constructors be private? What is a singleton class and its implementation patterns?
  4. What is constructor overloading?
  5. What is the default constructor? When is it created?
  6. Difference between shallow copy and deep copy
  7. What is object cloning? What is the Cloneable interface?
  8. What are the ways to create objects in Java? (new, reflection, clone, deserialization, factory)

Serialization & Reflectionโ€‹

  1. What is serialization and deserialization?
  2. What is serialVersionUID? Why is it important?
  3. Can we serialize static and transient variables?
  4. What is externalization? Difference between Serializable and Externalizable
  5. What is reflection API? When to use it?
  6. How to prevent serialization of a class?
  7. What are the security concerns with reflection?

String & Exception Handling (18 Questions)โ€‹

String Manipulationโ€‹

  1. What is String and String Constant Pool (String Intern Pool)?
  2. Difference between String, StringBuffer, and StringBuilder (with thread safety)
  3. Why are Strings immutable in Java? Benefits and drawbacks
  4. Difference between String literal and new String()
  5. Important String methods: equals(), equalsIgnoreCase(), substring(), charAt(), indexOf(), split(), trim(), replace()
  6. How to reverse a string in Java?
  7. How to check if a string is a palindrome?
  8. What is the time complexity of String concatenation using + vs StringBuilder?
  9. How many objects are created in String pool for: String s1 = "Hello"; String s2 = "Hello";?
  10. What is intern() method in String?

Exception Handlingโ€‹

  1. What is an Exception? Explain Java Exception Hierarchy
  2. Difference between checked and unchecked exceptions (with examples)
  3. What is the super-class for Exception and Error?
  4. Difference between Exception and Error
  5. Difference between throw and throws
  6. Can we have try without catch? Can we have multiple catch blocks?
  7. What is multi-catch block (Java 7)?
  8. What is the role of finally block? When does it not execute?
  9. Can we use return statement in finally block?
  10. How to create custom exceptions? (checked vs unchecked)
  11. What is try-with-resources (Java 7)?
  12. What is suppressed exceptions?
  13. Best practices for exception handling
  14. What is exception chaining?

Collections Framework (30 Questions)โ€‹

Core Conceptsโ€‹

  1. What is Collection Framework? Advantages over arrays
  2. Explain the Collections hierarchy (Collection, List, Set, Queue, Map)
  3. What are generics in Java? Why use them? (type safety, code reusability)
  4. What is type erasure in generics?
  5. Which interface doesn't extend Collection interface and why? (Map)
  6. How to make collections thread-safe? (Collections.synchronizedList, ConcurrentHashMap)
  7. What is the difference between Collection and Collections?
  8. What are bounded and unbounded wildcards in generics? (? extends T, ? super T)

List Interfaceโ€‹

  1. Difference between ArrayList and LinkedList (use cases, time complexity)
  2. Difference between ArrayList and Vector (thread safety, growth factor)
  3. When to use ArrayList vs LinkedList vs Vector?
  4. How to convert Array to List and vice versa?
  5. What is the initial capacity of ArrayList? How does it grow?
  6. How does ArrayList work internally? (dynamic array, resizing)
  7. What is CopyOnWriteArrayList? When to use it?
  8. How to sort a List? (Collections.sort, Comparable, Comparator)

Set Interfaceโ€‹

  1. Difference between Set and List (uniqueness, ordering)
  2. Difference between HashSet, LinkedHashSet, and TreeSet
  3. How does HashSet maintain uniqueness internally? (hashCode and equals contract)
  4. What happens if we add duplicate elements to a Set?
  5. How to convert List to Set?
  6. What is the time complexity of HashSet operations?
  7. What is CopyOnWriteArraySet?
  8. What is EnumSet?

Map Interfaceโ€‹

  1. What is Map interface? Key characteristics
  2. Difference between HashMap and Hashtable (thread safety, null values)
  3. How does HashMap work internally? (hashing, buckets, collision handling, linked list to tree conversion in Java 8)
  4. What is the time complexity of HashMap operations? (Best, Average, Worst case)
  5. How many nulls are allowed in HashMap, TreeMap, Hashtable, ConcurrentHashMap, LinkedHashMap?
  6. Different ways to iterate a Map (keySet, values, entrySet, forEach, Iterator)
  7. What is WeakHashMap? When to use it?
  8. What is IdentityHashMap?
  9. Difference between HashMap and ConcurrentHashMap
  10. What is the load factor in HashMap? What happens during rehashing?
  11. What is TreeMap? How does it maintain order?
  12. What is LinkedHashMap? Difference from HashMap
  13. How to sort a Map by keys and values?

Queue & Dequeโ€‹

  1. What is Queue interface? Common implementations
  2. What is PriorityQueue? How does it work?
  3. What is Deque? Difference between Queue and Deque
  4. What is ArrayDeque? When to use it over Stack?
  5. What is BlockingQueue? Use cases

Advanced Collections Conceptsโ€‹

  1. What is fail-fast and fail-safe iterators? (with examples)
  2. What is ConcurrentModificationException? How to avoid it?
  3. Difference between Comparable and Comparator
  4. What is the difference between poll() and remove() in Queue?
  5. What is the difference between offer() and add() in Queue?
  6. How to create immutable collections? (Collections.unmodifiableList, List.of)
  7. What is the diamond problem in generics?
  8. What are concurrent collections? (ConcurrentHashMap, ConcurrentLinkedQueue, CopyOnWriteArrayList)

Java 8+ Features (20 Questions)โ€‹

Lambda & Functional Programmingโ€‹

  1. What are Lambda expressions? Syntax and examples
  2. What are functional interfaces? Name built-in ones (Predicate, Function, Consumer, Supplier, BiFunction, UnaryOperator, BinaryOperator)
  3. What is method reference? Types of method references (static, instance, constructor)
  4. Difference between lambda expression and anonymous class
  5. What is the difference between Function and BiFunction?
  6. What are closure in Java?

Stream APIโ€‹

  1. What is Stream API? How is it different from Collections?
  2. What are intermediate and terminal operations? (filter, map, sorted vs collect, forEach, reduce)
  3. How to filter and map elements using Stream?
  4. How to find max, min, average, sum using Streams?
  5. How to group elements using Collectors.groupingBy()?
  6. How to sort collections using Streams?
  7. Difference between map() and flatMap() (with examples)
  8. What is the difference between findFirst() and findAny()?
  9. What is the difference between peek() and forEach()?
  10. How to convert Stream to List, Set, Map?
  11. What is parallel stream? When to use it?
  12. What are short-circuit operations in Stream? (anyMatch, allMatch, noneMatch)
  13. How to handle exceptions in Stream API?
  14. What is the difference between Collection.stream() and Collection.parallelStream()?

Optional & Other Featuresโ€‹

  1. What is Optional class? How to avoid NullPointerException using it?
  2. Important Optional methods (of, ofNullable, isPresent, ifPresent, orElse, orElseGet, orElseThrow)
  3. What are the new Date and Time API classes? (LocalDate, LocalDateTime, ZonedDateTime, Instant, Duration, Period)
  4. Difference between Date and LocalDate
  5. What are static and default methods in interfaces?
  6. What is the forEach method?
  7. What are the new features in Java 9, 11, 17, 21? (modules, var, records, sealed classes, pattern matching)

Multithreading & Concurrency (20 Questions)โ€‹

Thread Basicsโ€‹

  1. What is a thread? Difference between thread and process
  2. How to create threads in Java? (extending Thread vs implementing Runnable vs Callable)
  3. Difference between start() and run() method
  4. Can you start a thread twice? What happens?
  5. What is the thread lifecycle? (New, Runnable, Running, Blocked, Waiting, Timed Waiting, Terminated)
  6. What is thread priority? How to set it?
  7. What is a daemon thread? How to create it?
  8. Difference between user thread and daemon thread

Synchronization & Thread Safetyโ€‹

  1. What is synchronization? Why do we need it?
  2. What is the synchronized keyword? Where can it be used? (method level, block level, static method)
  3. What is a race condition? How to prevent it?
  4. What is deadlock? How to avoid it? (prevention strategies)
  5. What is livelock and starvation?
  6. Difference between sleep() and wait() methods
  7. What is the difference between notify() and notifyAll()?
  8. What is join() method? When to use it?
  9. What is thread-local variable?
  10. What is the volatile keyword? How does it ensure visibility?

Concurrency Utilities (Java.util.concurrent)โ€‹

  1. What is ConcurrentHashMap? How is it different from Hashtable and synchronized HashMap?
  2. How does ConcurrentHashMap achieve thread safety without synchronizing entire map?
  3. What is a thread pool? Benefits of using ExecutorService
  4. Types of ExecutorService (FixedThreadPool, CachedThreadPool, SingleThreadExecutor, ScheduledThreadPool)
  5. What is Future and Callable? Difference from Runnable
  6. What is CompletableFuture? How to use it?
  7. What are atomic variables? (AtomicInteger, AtomicLong, AtomicBoolean)
  8. What is the difference between CountDownLatch and CyclicBarrier?
  9. What is Semaphore? Use cases
  10. What are locks in Java? (ReentrantLock, ReadWriteLock)
  11. Difference between synchronized and ReentrantLock
  12. What is the happens-before relationship?

Spring Framework & Spring Boot (35 Questions)โ€‹

Core Conceptsโ€‹

  1. What is Spring Framework? Core modules
  2. What is Spring Boot? Advantages over traditional Spring
  3. What does @SpringBootApplication annotation do internally? (@Configuration, @EnableAutoConfiguration, @ComponentScan)
  4. What is Spring Boot Starter? Name important starters (web, data-jpa, security, test, actuator)
  5. What is auto-configuration in Spring Boot? How does it work?
  6. What is application.properties vs application.yml?
  7. How to externalize configuration in Spring Boot?
  8. What is Spring Boot DevTools?

Dependency Injection & IoCโ€‹

  1. What is Dependency Injection? Types of DI (Constructor, Setter, Field)
  2. What is IoC (Inversion of Control)?
  3. Difference between @Component, @Service, @Repository, @Controller
  4. What is @Autowired? Types of autowiring (byType, byName, constructor)
  5. Difference between @Autowired and @Resource and @Inject
  6. What are @Qualifier and @Primary annotations?
  7. What is constructor injection vs setter injection? Which is better?
  8. What is the Spring Bean lifecycle?
  9. What are the scopes of Spring beans? (singleton, prototype, request, session, application)
  10. Difference between singleton and prototype scope
  11. What is @PostConstruct and @PreDestroy?
  12. What is lazy initialization in Spring?

REST APIs & Web Layerโ€‹

  1. Difference between @Controller and @RestController
  2. What is @RequestMapping and its variants? (@GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping)
  3. What is @PathVariable vs @RequestParam vs @RequestBody?
  4. What is @ResponseBody and @ResponseEntity?
  5. How to handle exceptions in Spring Boot? (@ControllerAdvice, @ExceptionHandler, @ResponseStatus)
  6. What is content negotiation in Spring?
  7. How to implement pagination in Spring Boot?
  8. What is CORS? How to enable it in Spring Boot?
  9. How to validate request data? (@Valid, @Validated, validation annotations)
  10. What is @ModelAttribute?

Spring Data JPA & Databaseโ€‹

  1. What is Spring Data JPA?
  2. What is the difference between JPA and Hibernate?
  3. What are the annotations used in JPA? (@Entity, @Table, @Id, @GeneratedValue, @Column, @ManyToOne, @OneToMany, @ManyToMany)
  4. What is the difference between CrudRepository, JpaRepository, and PagingAndSortingRepository?
  5. What are JPQL and native queries?
  6. What is the N+1 query problem? How to solve it? (fetch joins, @EntityGraph)
  7. What is lazy loading vs eager loading?
  8. What is cascading in JPA?
  9. What is the difference between save() and saveAndFlush()?
  10. How to implement custom queries in Spring Data JPA? (@Query, method naming convention)

Spring Boot Featuresโ€‹

  1. What is Spring Boot Actuator? Important endpoints (/health, /metrics, /info, /env)
  2. What is the purpose of @Bean annotation?
  3. Difference between @Configuration and @Component
  4. What are Spring Boot Profiles? How to use them?
  5. What is @Value annotation?
  6. What is @ConfigurationProperties?
  7. How to implement caching in Spring Boot? (@Cacheable, @CacheEvict, @CachePut)
  8. What is Spring AOP? Core concepts (Aspect, Advice, Pointcut, JoinPoint)
  9. What is Spring Security? How to implement authentication and authorization?
  10. What is Spring Batch?

Microservices Architecture (25 Questions)โ€‹

Core Conceptsโ€‹

  1. What are microservices? Principles of microservices
  2. Advantages and disadvantages of microservices
  3. Difference between monolithic and microservices architecture
  4. When to use microservices vs monolithic architecture?
  5. What are the challenges in microservices? (distributed transactions, data consistency, network latency)
  6. What is Domain-Driven Design (DDD)?
  7. What is bounded context?

Service Discovery & API Gatewayโ€‹

  1. What is Service Discovery? (Eureka, Consul, Zookeeper)
  2. What is client-side vs server-side service discovery?
  3. What is API Gateway? (Spring Cloud Gateway, Zuul)
  4. What are the responsibilities of API Gateway? (routing, authentication, rate limiting, load balancing)
  5. What is the difference between API Gateway and Load Balancer?

Resilience & Fault Toleranceโ€‹

  1. What is Circuit Breaker pattern? (Resilience4j, Hystrix)
  2. What are the states of Circuit Breaker? (Closed, Open, Half-Open)
  3. What is bulkhead pattern?
  4. What is retry pattern?
  5. What is timeout pattern?
  6. What is rate limiting?
  7. What is the difference between throttling and rate limiting?

Communication Patternsโ€‹

  1. What is the difference between REST and gRPC?
  2. What is synchronous vs asynchronous communication in microservices?
  3. What is message queue? Examples (RabbitMQ, Kafka, ActiveMQ)
  4. Difference between message queue and event streaming (RabbitMQ vs Kafka)
  5. What is event-driven architecture?
  6. What is CQRS (Command Query Responsibility Segregation)?
  7. What is event sourcing?

Data Managementโ€‹

  1. What is Database per Service pattern?
  2. What is shared database pattern? Pros and cons
  3. What is SAGA pattern? (Choreography vs Orchestration)
  4. What is distributed transaction? 2PC (Two-Phase Commit)
  5. What is eventual consistency?
  6. What is API composition pattern?

Configuration & Monitoringโ€‹

  1. What is Spring Cloud Config? Centralized configuration management
  2. What is distributed tracing? (Sleuth, Zipkin, Jaeger)
  3. What is distributed logging? (ELK Stack - Elasticsearch, Logstash, Kibana)
  4. What is correlation ID?
  5. What are health checks in microservices?
  6. What is the 12-Factor App methodology?

Security & Deploymentโ€‹

  1. What is the difference between authentication and authorization?
  2. What is JWT (JSON Web Token)? How does it work?
  3. What is OAuth 2.0? Different grant types
  4. What is service mesh? (Istio, Linkerd)
  5. What is containerization? Docker basics
  6. What is Kubernetes? Key concepts (Pod, Service, Deployment, ReplicaSet)
  7. What is blue-green deployment?
  8. What is canary deployment?

SQL & Database Management (35 Questions)โ€‹

SQL Basicsโ€‹

  1. What is the difference between SQL and NoSQL databases?
  2. What are different types of SQL commands? (DDL, DML, DCL, TCL)
  3. Difference between WHERE and HAVING clause
  4. What are aggregate functions? (COUNT, SUM, AVG, MAX, MIN, GROUP_CONCAT)
  5. What is GROUP BY? How does it work with HAVING?
  6. What is the difference between DISTINCT and GROUP BY?
  7. What are SQL clauses execution order? (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT)
  8. What is the difference between COUNT(*), COUNT(1), and COUNT(column)?

Joins & Subqueriesโ€‹

  1. What are different types of JOINs? (INNER, LEFT, RIGHT, FULL OUTER, CROSS, SELF)
  2. Difference between INNER JOIN and OUTER JOIN
  3. What is a self-join? Use cases
  4. What is a cross join? When to use it?
  5. What is the difference between UNION and UNION ALL?
  6. What is the difference between INTERSECT and EXCEPT?
  7. What are subqueries? Types of subqueries (scalar, row, table, correlated)
  8. What is a correlated subquery? Difference from nested subquery
  9. What is the difference between JOIN and subquery? Performance implications

Constraints & Keysโ€‹

  1. What are primary key and foreign key?
  2. What is a composite key?
  3. What is a candidate key and alternate key?
  4. What is a super key?
  5. What are constraints in SQL? (NOT NULL, UNIQUE, CHECK, DEFAULT, PRIMARY KEY, FOREIGN KEY)
  6. What is the difference between UNIQUE and PRIMARY KEY?
  7. Can a table have multiple primary keys?
  8. What is ON DELETE CASCADE and ON UPDATE CASCADE?

Indexes & Performance Optimizationโ€‹

  1. What is an index? Why use indexes?
  2. Types of indexes (clustered, non-clustered, unique, composite, full-text, spatial)
  3. What is a clustered vs non-clustered index?
  4. How many clustered indexes can a table have?
  5. When should you use indexes? Advantages and disadvantages
  6. What is index cardinality?
  7. How to optimize SQL queries? (EXPLAIN, query execution plan, avoiding SELECT *, using indexes)
  8. What is query execution plan?
  9. What is the difference between covering index and included columns?
  10. What causes slow queries? (missing indexes, full table scans, complex joins, large result sets)

Transactions & ACID Propertiesโ€‹

  1. What are ACID properties? (Atomicity, Consistency, Isolation, Durability)
  2. What is a transaction? How to manage transactions? (BEGIN, COMMIT, ROLLBACK, SAVEPOINT)
  3. What are different isolation levels? (READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, SERIALIZABLE)
  4. What is dirty read, non-repeatable read, and phantom read?
  5. What is the default isolation level in most databases?
  6. What is optimistic locking vs pessimistic locking?
  7. What is deadlock in database? How to detect and prevent it?

Normalization & Database Designโ€‹

  1. What is normalization? Why is it important?
  2. What are different normal forms? (1NF, 2NF, 3NF, BCNF, 4NF, 5NF)
  3. What is denormalization? When to use it?
  4. What is the difference between star schema and snowflake schema?
  5. What is ER diagram?
  6. What are the types of relationships? (one-to-one, one-to-many, many-to-many)

Advanced SQL Conceptsโ€‹

  1. What is a stored procedure? Advantages and disadvantages
  2. Difference between stored procedure and function
  3. What are triggers? Types of triggers (BEFORE, AFTER, INSTEAD OF)
  4. What is a view? Benefits of using views
  5. Difference between view and materialized view
  6. What is a CTE (Common Table Expression)? Difference from subquery
  7. What are window functions? (ROW_NUMBER, RANK, DENSE_RANK, NTILE, LAG, LEAD)
  8. What is the difference between RANK and DENSE_RANK?
  9. What is the N+1 query problem? How to solve it?
  10. Difference between DELETE, TRUNCATE, and DROP
  11. What is database partitioning? Types (horizontal, vertical, range, hash, list)
  12. What is database sharding?
  13. What is replication? Types (master-slave, master-master)
  14. What is connection pooling? Why is it important?

DBMS Concepts (25 Questions)โ€‹

Database Architecture & Storageโ€‹

  1. What is DBMS? Advantages over file system
  2. What are the components of DBMS architecture? (Query Processor, Storage Manager, Transaction Manager)
  3. What is a database schema? Types (physical, logical, view level)
  4. What is data independence? Types (physical, logical)
  5. What is the difference between physical and logical data independence?
  6. What is a data dictionary?
  7. How is data stored in database? (pages, blocks, extents)
  8. What is B-tree and B+ tree? How are they used in indexing?
  9. What is the difference between B-tree and B+ tree?

Concurrency Controlโ€‹

  1. What is concurrency control? Why is it needed?
  2. What are different concurrency control protocols? (Lock-based, Timestamp-based, Validation-based)
  3. What is two-phase locking (2PL)? (Growing phase, Shrinking phase)
  4. What are shared locks and exclusive locks?
  5. What is timestamp ordering protocol?
  6. What is MVCC (Multi-Version Concurrency Control)?
  7. How does PostgreSQL handle concurrency differently from MySQL?

Database Recoveryโ€‹

  1. What is database recovery? Why is it important?
  2. What is a log-based recovery? (undo, redo)
  3. What is checkpoint in database?
  4. What is shadow paging?
  5. What is crash recovery?

Query Processing & Optimizationโ€‹

  1. What is query processing? Steps involved
  2. What is query optimization?
  3. What is cost-based optimization vs rule-based optimization?
  4. What is the role of query optimizer?
  5. What is an execution plan?
  6. What is query rewriting?

Distributed Databasesโ€‹

  1. What is a distributed database?
  2. What is data fragmentation? (horizontal, vertical, hybrid)
  3. What is data replication?
  4. What is distributed query processing?
  5. What is CAP theorem? (Consistency, Availability, Partition Tolerance)
  6. What is BASE properties? (Basically Available, Soft state, Eventually consistent)
  7. Difference between ACID and BASE

NoSQL Databasesโ€‹

  1. What are NoSQL databases? Types (Document, Key-Value, Column-Family, Graph)
  2. When to use NoSQL vs SQL databases?
  3. What is MongoDB? Key features
  4. What is Redis? Use cases
  5. What is Cassandra? When to use it?
  6. What is eventual consistency in NoSQL?

Operating System Concepts (25 Questions)โ€‹

Process Managementโ€‹

  1. What is an operating system? Main functions
  2. What is a process? Difference between process and program
  3. What are the states of a process? (New, Ready, Running, Waiting, Terminated)
  4. What is Process Control Block (PCB)?
  5. What is context switching?
  6. What is the difference between process and thread?
  7. What is multithreading? Advantages
  8. What is thread synchronization?
  9. What are user-level threads vs kernel-level threads?

CPU Schedulingโ€‹

  1. What is CPU scheduling? Why is it needed?
  2. What are different CPU scheduling algorithms?
  • FCFS (First Come First Serve)
  • SJF (Shortest Job First)
  • Round Robin
  • Priority Scheduling
  • Multilevel Queue Scheduling
  1. What is preemptive vs non-preemptive scheduling?
  2. What is convoy effect?
  3. What is starvation? How to prevent it?
  4. What is aging in OS?

Memory Managementโ€‹

  1. What is memory management? Why is it important?
  2. What is paging? What is a page table?
  3. What is segmentation? Difference between paging and segmentation
  4. What is virtual memory? How does it work?
  5. What is demand paging?
  6. What is page replacement algorithms? (FIFO, LRU, Optimal, LFU)
  7. What is thrashing? How to prevent it?
  8. What is the difference between logical and physical address?
  9. What is TLB (Translation Lookaside Buffer)?

Deadlockโ€‹

  1. What is deadlock? Necessary conditions for deadlock (Mutual Exclusion, Hold and Wait, No Preemption, Circular Wait)
  2. What are deadlock handling strategies? (Prevention, Avoidance, Detection, Recovery)
  3. What is Banker's algorithm?
  4. What is resource allocation graph?

File Systemโ€‹

  1. What is a file system? Types (FAT32, NTFS, ext4)
  2. What is inode?
  3. What is the difference between hard link and soft link?
  4. What are different file allocation methods? (Contiguous, Linked, Indexed)

Inter-Process Communication & Synchronizationโ€‹

  1. What is Inter-Process Communication (IPC)? Methods (Pipes, Message Queues, Shared Memory, Sockets)
  2. What is semaphore? Types (Binary, Counting)
  3. What is mutex? Difference between mutex and semaphore
  4. What is the producer-consumer problem?
  5. What is the reader-writer problem?
  6. What is the dining philosophers problem?

System Design & Architecture (20 Questions)โ€‹

Design Principlesโ€‹

  1. What are SOLID principles?
  • Single Responsibility Principle
  • Open/Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle
  1. What are design patterns? Categories (Creational, Structural, Behavioral)
  2. What is Singleton pattern? How to implement thread-safe singleton?
  3. What is Factory pattern vs Abstract Factory pattern?
  4. What is Builder pattern? When to use it?
  5. What is Prototype pattern?
  6. What is Adapter pattern?
  7. What is Decorator pattern?
  8. What is Proxy pattern?
  9. What is Observer pattern?
  10. What is Strategy pattern?
  11. What is Template Method pattern?

Scalability & Performanceโ€‹

  1. What is horizontal vs vertical scaling?
  2. What is load balancing? Types (Round Robin, Least Connections, IP Hash)
  3. What is caching? Caching strategies (Cache-aside, Write-through, Write-back, Read-through)
  4. What is CDN (Content Delivery Network)?
  5. What is database replication? Master-slave vs master-master
  6. What is database sharding? Sharding strategies
  7. What is rate limiting? Implementation approaches
  8. What is the difference between latency and throughput?

REST API & Web Services (15 Questions)โ€‹

REST Fundamentalsโ€‹

  1. What is REST? REST principles (Stateless, Client-Server, Cacheable, Uniform Interface, Layered System)
  2. What are HTTP methods? (GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD)
  3. What is the difference between PUT and PATCH?
  4. What are HTTP status codes?
  • 2xx: Success (200, 201, 204)
  • 3xx: Redirection (301, 302, 304)
  • 4xx: Client Error (400, 401, 403, 404, 409)
  • 5xx: Server Error (500, 502, 503)
  1. What is idempotency? Which HTTP methods are idempotent?
  2. What is the difference between REST and SOAP?
  3. What is RESTful API design best practices?
  4. What is HATEOAS?
  5. What is API versioning? Strategies (URI, Header, Query Parameter)

API Securityโ€‹

  1. What are different authentication mechanisms? (Basic Auth, Bearer Token, OAuth, JWT, API Key)
  2. What is the difference between authentication and authorization?
  3. What is OAuth 2.0? OAuth flow
  4. What is JWT? Structure of JWT (Header, Payload, Signature)
  5. What is the difference between stateless and stateful authentication?
  6. What is CORS? How to handle it?

Testing & Best Practices (15 Questions)โ€‹

Testingโ€‹

  1. What are different types of testing? (Unit, Integration, System, Acceptance)
  2. What is JUnit? Common annotations (@Test, @Before, @After, @BeforeClass, @AfterClass)
  3. What is Mockito? How to mock objects?
  4. What is the difference between mock and stub?
  5. What is TDD (Test-Driven Development)?
  6. What is code coverage? Is 100% coverage necessary?
  7. What is integration testing in Spring Boot? (@SpringBootTest, @WebMvcTest, @DataJpaTest)
  8. How to test REST APIs? (MockMvc, RestTemplate, TestRestTemplate)

Code Quality & Best Practicesโ€‹

  1. What are coding standards and why are they important?
  2. What is code smell? Examples
  3. What is refactoring?
  4. What is clean code? Key principles
  5. What is DRY (Don't Repeat Yourself)?
  6. What is KISS (Keep It Simple, Stupid)?
  7. What is YAGNI (You Aren't Gonna Need It)?

Git & Version Control (10 Questions)โ€‹

  1. What is Git? Difference between Git and GitHub
  2. What are basic Git commands? (clone, pull, push, commit, merge, rebase, branch, checkout)
  3. What is the difference between git pull and git fetch?
  4. What is the difference between git merge and git rebase?
  5. What is a merge conflict? How to resolve it?
  6. What is branching strategy? (GitFlow, GitHub Flow, Trunk-Based Development)
  7. What is a pull request? Code review process
  8. What is .gitignore file?
  9. What is git stash?
  10. What is the difference between git reset and git revert?

Practical Coding Problems (25 Questions)โ€‹

Array & String Problemsโ€‹

  1. Find the second largest element in an array
  2. Reverse a string without using built-in methods
  3. Check if a string is a palindrome
  4. Find all duplicate elements in an array
  5. Find the missing number in an array of 1 to n
  6. Rotate an array by k positions
  7. Find the first non-repeating character in a string
  8. Check if two strings are anagrams
  9. Implement string compression (e.g., "aabbbcccc" -> "a2b3c4")
  10. Find all pairs in array that sum to a target value

Collections Problemsโ€‹

  1. Remove duplicates from ArrayList
  2. Sort a HashMap by values
  3. Find frequency of each element in a list
  4. Merge two sorted lists
  5. Find the intersection of two lists
  6. Implement LRU Cache using LinkedHashMap
  7. Group anagrams from a list of strings
  8. Find top K frequent elements

Stream API Problemsโ€‹

  1. Find sum of all even numbers in a list using Streams
  2. Convert list of strings to uppercase using Streams
  3. Filter employees with salary > 50000 and sort by name
  4. Group employees by department using Streams
  5. Find the average salary of employees using Streams
  6. Flatten a list of lists using flatMap
  7. Find the longest string from a list using Streams

Scenario-Based Questions (15 Questions)โ€‹

Performance & Optimizationโ€‹

  1. How would you optimize a slow-running query?
  2. How would you handle high traffic on your application?
  3. How would you design a caching strategy for an e-commerce application?
  4. How would you handle memory leaks in a Java application?
  5. How would you optimize a Spring Boot application startup time?

Architecture & Designโ€‹

  1. Design a URL shortener service (like bit.ly)
  2. Design a rate limiter
  3. Design a notification system
  4. Design a file upload and download system
  5. How would you design a shopping cart system?

Problem Solvingโ€‹

  1. How would you handle a situation where microservices are failing?
  2. How would you implement distributed transactions across microservices?
  3. How would you handle data consistency in microservices?
  4. How would you debug a production issue with minimal logs?
  5. How would you migrate from monolithic to microservices architecture?

Behavioral & Situational Questions (10 Questions)โ€‹

  1. Tell me about a challenging bug you fixed
  2. Describe a time when you optimized application performance
  3. How do you stay updated with new technologies?
  4. Describe your experience with code reviews
  5. How do you handle disagreements with team members?
  6. Tell me about a project you're most proud of
  7. How do you prioritize tasks when working on multiple projects?
  8. Describe a situation where you had to learn a new technology quickly
  9. How do you ensure code quality in your projects?
  10. What's your approach to debugging a complex issue?

Quick Reference: Interview Preparation Strategyโ€‹

Week 1-2: Core Fundamentalsโ€‹

  • โœ… Java basics, OOP, Collections
  • โœ… String manipulation, Exception handling
  • โœ… Multithreading basics
  • โœ… Practice 20-30 coding problems

Week 3-4: Advanced Java & Frameworksโ€‹

  • โœ… Java 8+ features (Streams, Lambda, Optional)
  • โœ… Spring Boot, Spring Data JPA
  • โœ… REST API design
  • โœ… Practice integration problems

Week 5-6: Database & System Designโ€‹

  • โœ… SQL queries, joins, indexes
  • โœ… DBMS concepts (normalization, transactions)
  • โœ… Design patterns
  • โœ… Microservices architecture

Week 7-8: Advanced Topics & Mock Interviewsโ€‹

  • โœ… OS concepts (for system-level understanding)
  • โœ… Microservices patterns
  • โœ… System design scenarios
  • โœ… Mock interviews and revision

Important Tips for Interview Successโ€‹

Technical Round Preparationโ€‹

  1. Understand, don't memorize: Focus on concepts and use cases
  2. Practice coding: Write actual code for each concept
  3. Real-world examples: Always relate to practical scenarios
  4. Ask clarifying questions: Show your thought process
  5. Test your code: Always consider edge cases

Common Mistakes to Avoidโ€‹

  • โŒ Not asking clarifying questions
  • โŒ Jumping to code without thinking
  • โŒ Not considering edge cases
  • โŒ Poor time management in coding rounds
  • โŒ Not testing the solution
  • โŒ Getting stuck on one approach
  • โŒ Not communicating your thought process

During the Interviewโ€‹

  • โœ… Listen carefully to the question
  • โœ… Think out loud
  • โœ… Start with a brute force approach, then optimize
  • โœ… Write clean, readable code
  • โœ… Test with examples
  • โœ… Be honest if you don't know something
  • โœ… Show enthusiasm and curiosity

Resources for Practiceโ€‹

  • Coding: LeetCode, HackerRank, CodeSignal
  • System Design: System Design Primer, Designing Data-Intensive Applications
  • Java: Effective Java, Java Concurrency in Practice
  • Spring Boot: Official Spring documentation, Baeldung
  • SQL: SQLZoo, HackerRank SQL

Topic-wise Priority for Different Experience Levelsโ€‹

Fresher (0-2 years)โ€‹

High Priority: Core Java, OOP, Collections, String, Exception Handling, SQL Basics Medium Priority: Java 8 Features, Spring Boot Basics, Basic Multithreading Low Priority: Advanced Microservices, Complex System Design

Mid-Level (2-5 years)โ€‹

High Priority: All Java topics, Spring Boot, REST APIs, SQL Advanced, Collections Advanced Medium Priority: Microservices, Design Patterns, System Design Basics, DBMS Low Priority: Advanced OS concepts, Complex distributed systems

Senior (5+ years)โ€‹

High Priority: Microservices, System Design, Architecture Patterns, Performance Optimization Medium Priority: All technical topics (should be strong) Focus On: Leadership, Trade-offs, Scalability, Team collaboration


Final Checklist Before Interviewโ€‹

Day Beforeโ€‹

  • Review key concepts in your weak areas
  • Practice 5-10 coding problems
  • Review your resume and projects thoroughly
  • Prepare questions to ask the interviewer
  • Get good sleep

Interview Dayโ€‹

  • Have your IDE/editor ready (for online coding)
  • Stable internet connection
  • Pen and paper for rough work
  • Water/coffee
  • Calm mind and positive attitude

Total Questions: 525+ covering all aspects of Java Backend Development

_This comprehensive guide is designed for 2025 interview patterns. Focus on understanding concepts deeply rather than memorizing answers. Practice regularly and build projects to solidify your knowledge. Good luck! _